<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="../lib/reset.css">
    <style>
        .sideMenu {
            width: 50px;
            height: 100px;
            background-color: red;
            position: fixed;
            right: -50px;
            top: 50%;
            margin-top: -50px;
        }
        .sideMenu .trigger {
            width: 20px;
            height: 20px;
            background-color: blue;
            position: absolute;
            top: 50%;
            margin-top: -10px;
            left: -20px;
            cursor: pointer;
        }
    </style>

    <script src="../lib/jquery-3.1.0.js"></script>
    <script>
        $(document).ready(function() {
            var $sideMenu = $('.sideMenu');
            $('.trigger').on('mouseover', function() { // click
                timer = setTimeout(function(e) {
                    var left = 0;
                    $sideMenu.animate({right: left}, 500);
                },200);

                $('.trigger').on('mouseleave',function() {
                    timer = setTimeout(function(e) {
                        $sideMenu.animate({right: -50}, 500);
                    },200)
                });
                /*if ($sideMenu.hasClass('r0')) {
                    $sideMenu.animate({right: -50}, 500).removeClass('r0');
                } else {
                    $sideMenu.animate({right: 0}, 500).addClass('r0');
                }*/
            });

        });
    </script>
</head>
<body>
    
    <div class="sideMenu">
        <div class="trigger"></div>
    </div>

</body>
</html>